const initSDK = () => {};

const tempElectronSDK: any = (window as any).electronSDK || initSDK;

console.log(`当前运行环境为：${tempElectronSDK ? "electron" : "浏览器"}`);

const proxyTarget = (target: any) => {
  return new Proxy(target, {
    get(obj, prop) {
      if (prop in obj) {
        return obj[prop];
      } else {
        console.warn(
          `当前环境下没有electronSDK${prop.toString()},如果想兼容运行，请在proxy里做环境的适配实现`
        );
        return proxyTarget(initSDK);
      }
    },
  });
};

const electronSDK = proxyTarget(tempElectronSDK);

export default electronSDK;
